def getTax():
    income=int(input("请输入你的收:"))
    if(income<=0):
        print("null")
    else:
        if(income<=5000):
            tax = income * 0.00
        elif(income<=15000):
            tax = income * 0.1 - 500
        elif(income<=30000):
            tax = income * 0.2 - 555
        elif(income<=45000):
            tax = income * 0.3 - 1005
        elif(income<=60000):
            tax = income * 0.35 - 2755
        elif(income<=90000):
            tax = income * 0.45 - 5505
        else:
            tax = income * 0.45 - 13505
        print("你的税为：",tax)
# getTax()

# 函数回调
def age(n):
    if(n==1):
        return 10
    else:
        return age(n-1)+2
# print(age(5))

# for循环
def sum(n):
  sum=0
  for i in range(1,n+1):
    if i==50:
        break
    sum+=i
  print("结果是：",sum)
sum(100)

# while循环
def sumWhile(n):
    sum=0
    i=1
    while(i<=n):
        i+=1
        if i%2==0:
            continue
        sum+=i
        i+=1
    print("结果是：",sum)
sumWhile(100)

# 写字母P
def drawP():
    for i in range(10):
        if i in [0,5]:
            print("**********")
        elif i in [1,2,3,4]:
            print("*        *")
        else:
            print("*")
drawP()

# 计算阶乘和 1!+2!+3!+...+n!
def sumFactorial():
    n = int(input("请输入一个正整数："))
    jie = 1
    sum = 0
    i = 1
    while n>=i:
        jie*=i
        sum+=jie
        i+=1
    print("阶乘和为：",sum)
# sumFactorial()
    
# 打印所有水仙花数
def printSqr():
    for i in range(100,1000):
        a=i//100
        b=(i-a*100)//10
        c=i%10
        if(a**3+b**3+c**3==i):
            print(i,end=",")
# printSqr()
            
# 统计字符串中字母空格数字和其他字符数量
def count():
    s=input("请输入一个字符串：")
    letter=0
    space=0
    digit=0
    other=0
    for i in s:
        if i.isalpha():
            letter+=1
        elif i.isspace():
            space+=1
        elif i.isdigit():
            digit+=1
        else:
            other+=1
    print("字母：",letter)
    print("空格：",space)
    print("数字：",digit)
    print("其他：",other)
# count()
    
# 九九乘法表
def ji():
    for i in range(1,10):
        for j in range(1,i+1):
            print(j,"*",i,"=",i*j,end=" ")
        print()
# ji()
def jiu():
    i=1
    while(i<10):
        j=1
        while(j<=i):
            # print(j,"*",i,"=",i*j,end=" ")
            print("%d*%d=%-2d "%(j,i,j*i),end =" ")
            # %d 是占位符，表示这里将被一个整数替换。%-2d 中的 - 表示左对齐，2 表示最小字段宽度为2个字符，如果实际数字占用的字符少于2个，则用空格填充右侧
            # % 操作符用于将后面的元组中的值插入到前面的格式化字符串中
            j+=1
        print()
        i+=1
# jiu()

# 100以内的素数
def prime():
    for i in range(2,101):
        for j in range(2,i):
            if i%j==0:
                break
        else: #为 for 或 while 循环指定一个 else 子句。这个 else 子句在循环正常结束（即没有被 break 语句中断）的情况下执行
            print(i,end=" ")
# prime()
def prime2():
    i=2
    while i<=100:
        j=2
        while j<i:
            if i%j==0:
                break
            j+=1
        else:
            print(i,end=" ")
        i+=1
# prime2()

# 打印正方形
def printSquare():
    numA=int(input("请输入一个正整数："))
    numB=int(input("请输入一个正整数："))
    for i in range(numA+1):
        for j in range(numB+1):
            print("*",end=" ")
        print()
# printSquare()
        
# 打印直角三角形
def printTriangle():
    numA=int(input("请输入一个正整数："))
    numB=int(input("请输入一个正整数："))
    for i in range(numA+1):
        for j in range(numB+1):
            if j<=i:
                print("*",end=" ")
            else:
                print(" ",end=" ")
        print()
# printTriangle()

# 打印等腰三角形
def printTriangle2():
    for i in range(4):
        for j in range(7):
            if j<=3+i and j>=3-i:
                print("*",end=" ")
            else:
                print(" ",end=" ")
        print()
printTriangle2()

# 模拟取款输入密码
def getMoney():
    name="liqian"
    password="123456"
    for i in [2,1,0]:
        name=input("请输入用户名：")
        password=input("请输入密码：")
        if name=="liqian" and password=="123456":
            print("~~~欢迎%s使用银行自助服务系统~~~"%name)
            break
        else:
            if i !=0:
                print("!!!登录失败!!!您还有%d次机会"%i)
            else:
                print("!!!登录失败!!!")
# getMoney()